package com.hbnu.system.controller;

import com.baomidou.mybatisplus.extension.api.ApiController;
import com.hbnu.system.core.base.Rest;
import com.hbnu.system.model.entity.TPlatformfile;
import com.hbnu.system.service.TPlatformfileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;

@RestController
@RequestMapping("tplatformfile")
@Api(tags = "科研平台文件模块")
public class TPlatformfileController extends ApiController {

    /**
     * 服务对象
     */
    @Resource
    private TPlatformfileService tPlatformfileService;

    @ApiOperation("科研平台-文件信息上传")
    @PostMapping("/addtPlatformfile")
    public Rest<Boolean> addtPlatformfile(@RequestBody TPlatformfile tPlatformfile){
        boolean add = tPlatformfileService.addTPlatformfile(tPlatformfile);
        return add ? Rest.success() : Rest.failed();
    }
    @ApiOperation("科研平台-文件信息删除")
    @GetMapping("/DeletetPlatformfile")
    public Rest<Boolean> DeletetPlatformfile(String fileID)throws IOException {
        boolean delete = tPlatformfileService.deletTPlatformfile(fileID);
        return delete ? Rest.success() : Rest.failed();
    }
    @ApiOperation("科研平台-文件信息分页查询")
    @GetMapping ("/pagetPlatformfileCondition")
    public Rest<List<TPlatformfile>> pagetPlatformfileConditionfile(String id){
        List<TPlatformfile> page = tPlatformfileService.pageTPlatformfile(id);
        return Rest.success(page);
    }
}
